#include <iostream>

using namespace std;

/*
 * 利用do while求解所有的水仙花数
 * 水仙花数指 3个数，每位的数字的3次幂之和等于本身
 */

int main() {
    int num = 100;
    do {
        int hundredNum = num / 100;
        int tenNum = (num / 10) % 10;
        int oneNum = (num % 100) % 10;
//        cout << hundredNum << endl;
//        cout << tenNum << endl;
//        cout << oneNum << endl;
        if(hundredNum*hundredNum*hundredNum + tenNum*tenNum*tenNum + oneNum*oneNum*oneNum == num) {
            cout << num << "是水仙花数" << endl;
        }
        num ++;
    } while (num < 1000);
    return 0;
}
